package com.jsmy.marketing.manager;

import com.jsmy.marketing.bean.LoginBean;
import com.jsmy.marketing.utils.SharedP;

/**
 * Created by PC_WLT on 2018/8/24.
 * 用户实体存储
 */

public class UserManager {

    private String dkzt;
    private String ico;
    private String id;
    private String tagid;
    private String title;
    private String username;

    private static UserManager instance=new UserManager();

    public UserManager() {
    }

    public static UserManager getInstance() {
        return instance;
    }
    public boolean isLogin(){
        return SharedP.getBooleanBySharedP("isLogin");
    }


    public void setIsLogin(boolean isLogin){
        SharedP.putBooleanBySharedP("isLogin",isLogin);
    }
    public String getName() {
        return SharedP.getStringBySharedP("name");
    }

    public void setName(String name) {
        SharedP.putStringBySharedP("name",name);
    }

    public String getPassword() {
        return SharedP.getStringBySharedP("password");
    }

    public void setPassword(String password) {
        SharedP.putStringBySharedP("password",password);
    }

    public String getLid() {
        return SharedP.getStringBySharedP("lid");
    }

    public void setLid(String lid) {
        SharedP.putStringBySharedP("lid",lid);
    }

    public void clear(){
        SharedP.clearSharedP();
    }

    public String getDkzt() {
        return SharedP.getStringBySharedP("dkzt");
    }

    public void setDkzt(String dkzt) {
        SharedP.putStringBySharedP("dkzt",dkzt);
    }

    public String getIco() {
        return SharedP.getStringBySharedP("ico");
    }

    public void setIco(String ico) {
        SharedP.putStringBySharedP("ico",ico);
    }

    public String getId() {
        return SharedP.getStringBySharedP("id");
    }

    public void setId(String id) {
        SharedP.putStringBySharedP("id",id);
    }

    public String getTagid() {
        return SharedP.getStringBySharedP("tagid");
    }

    public void setTagid(String tagid) {
        SharedP.putStringBySharedP("tagid",tagid);
    }

    public String getTitle() {
        return SharedP.getStringBySharedP("title");
    }

    public void setTitle(String title) {
        SharedP.putStringBySharedP("title",title);
    }

    public String getUsername() {
        return SharedP.getStringBySharedP("username");
    }

    public void setUsername(String username) {
        SharedP.putStringBySharedP("username",username);
    }

    public void saveUser(LoginBean.DataBean dataBean){
        setUsername(dataBean.getUsername());
        setPassword(dataBean.getPassword());
        setDkzt(dataBean.getDkzt());
        setIco(dataBean.getIco());
        setId(dataBean.getId()+"");
        setLid(dataBean.getLid());
        setTagid(dataBean.getTagid()+"");
        setTitle(dataBean.getTitle());
    }
    public LoginBean.DataBean getUser(){
        LoginBean.DataBean user=new LoginBean.DataBean();
        user.setDkzt(getDkzt());
        user.setIco(getIco());
        user.setId(getId());
        user.setPassword(getPassword());
        user.setTagid(getTagid());
        user.setTitle(getTitle());
        user.setUsername(getUsername());
        user.setLid(getLid());
        return user;
    }
}
